I am trying to use the YouTube Analytics API in an android app I'm writing but I'm stuck.
All of Google's documentation I've read says that I am required to use the client_secret when querying YouTube. However, when I registered my app with the APIs Console it did not give me a client_secret.
my API console
How do I access the API without the client_secret, as well how do I use the refresh token without the client_id. I have been working on this for 4 days now and I haven't been able to find the answer.
Client secret is just an option in Android, you can use AccountPicker
In the YouTube Direct Lite Sample project, there is a great example of usage you can check. It's using AccountPicker to pick account then authorizes though GoogleAuthUtil
Related
Please help me to find out the documentation on how to use java MASL SDK to get access_token for a service principal.
I am looking to find the documentation or GIT links which can guide me how to use the MASL library including the code samples.
I have gone through this link but it does not help me much : https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows
And, I am not expecting code samples to be shared here. I just want to find out where to find such data. I am struggling a lot when it comes to finding the right knowledge with respect to azure learning. What am I missing here? Is there any azure reference link available to find such information at a centralized place?
Note that, based on your requirement you can make use of Authorization code Flow if you want the user to sign-in and authenticate and if you want to access API using Application then make use of Client Credential Flow.
I tried to reproduce the same in my environment and got the results like below:
I created an Azure AD Application and added API permission:
For Client-Credential Flow, refer this GitHub blog by siddhijain.
Use the MASL java SDK to authenticate user in azure function developed in java.
Assuming that you want to authenticate user, you can make use of Authorization code Flow to generate access token.
I generated the Authorization code by using below endpoint:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/authorize?
&client_id=ClientID
&response_type=code
&redirect_uri=RedirectUri
&response_mode=query
&scope=https://management.azure.com/user_impersonation
&state=12345
A sign-in screen will appear for authenticating the user:
To generate the access token, I used below parameters:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id:ClientID
client_secret:ClientSecret
scope:https://management.azure.com/user_impersonation
grant_type:authorization_code
redirect_uri:RedirectUri
code:code
I am able to call the Function by using above generated access token:
To implement the above in MSAL Java library, refer the below GitHub Blogs:
Microsoft-authentication-library-for-js/msal-node/auth-code AzureAD by derisen
Microsoft-authentication-library-for-js/samples/msal-node AzureAD by rgins16
I'm trying to set up Microsoft Translation API (part of MS Cognitive Services) in my Android app (using Java). I'm relatively new to Android programming and authentication methods, and I'm a bit confused with the those ones.
When I registered for an Azure account I created an Azure Directory, then created an Android App in the portal, configured it and got my auth_config.json .
Well, when I checked the MS translator API docs I saw that I can use it through a GET request and the API key provided. But also I saw I can authenticate by using a token, and that's where I'm stuck.
I've searching for days and I cannot find a clear and concise tutorial/guide/docs to Authenticate (no user context) from my Android app in order to use MS translate API by using tokens.
I found this link but it's only applicable when users have to sign in.
Any help related to auth tokens flow and conceptual design of them is also welcomed, but the main question would be "How to authenticate an Android App (no user context) by using tokens for accessing an Azure API?"
Thanks.
It sounds like you are trying to create a native Android Application using Java to get an access token in order to utilize the MS Translator API. But you would like to flow to be non-interactive.
You shouldn't need to get an access token in order to utilize the MS Translator API. Per the documentation you will only need to get the translator keys and then you will be able to use the Translator REST API using the Translator key.
The Translator Getting Started on how to setup and get keys can be found here :
https://learn.microsoft.com/en-us/azure/cognitive-services/translator/translator-text-how-to-signup
And the documentation on how to use the Translator API in Java can be found here :
https://learn.microsoft.com/en-ca/azure/cognitive-services/translator/quickstart-java-translate
In addition to that, I think it's important to understand the concepts of how to get access tokens from Microsoft for the future.
The v2.0(also referred to as converged) endpoint flows and explanation on how the authentication process works can be found here under "concepts > authentication > OAuth2 .... flow".
https://learn.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios
That being said, the MSAL library doesn't necessarily have all these flows implemented yet. To see more information on what MSAL libraries support what auth flows, you can find this information at the link here :
https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows
Unfortunately we don't support the non-interactive flow using the MSAL Android library yet. If you're interested in this feature please submit an issue against the MSAL Android Library here : https://github.com/AzureAD/microsoft-authentication-library-for-android/issues
And one of the engineers that handles the library will reach out and discuss it further.
All the Azure AD libraries have wikis that can be found on their respective github repos. The MSAL Android one can be found here : https://github.com/AzureAD/microsoft-authentication-library-for-android/wiki
Hopefully this has been helpful, and if you have anymore questions please leave a comment.
Essentially you won't need to use MSAL and you should be able to just use the translator key to make calls to the MS Translator API.
All what I need is in the title, I'm looking for the process to get an access token from OAuth for my google app engine account (It's to use API which isn't in the google libraries).
I already create a OAuth client ID on my google console, but now I don't know what to do, how to get my access token?
PS: It's to use in the proximity beacon API from the server directly
I'm implementing a service that automatically uploads videos to a YouTube channel once they are uploaded on a different server.
When I first started I was using ClientLogin authentication and YouTube API v2.0 – Direct Uploading and everything worked perfectly. However, since ClientLogin is deprecated, I'm trying to update to use v3.0.
I checked this documentation and it assumes that the file is stored locally, which in my case is not, and this service will not be running on my local machine, and I'm not able to get the access token for OAuth 2.0.
Can anybody provide guidance?
You can do so by getting a refresh token from OAuth2 Playground and setting it in your youtube object.
Here it explains a little more.
And a step by step video.
I am using Google+ in my app. And I can share content using following code
Intent shareIntent = new PlusShare.Builder(ViewGooglePlus.this)
.setText("Android Testing for Google+")
.setType("text/plain")
.setContentUrl(
Uri.parse("http://androidsolution4u.blogspot.in/"))
.getIntent()
.setPackage("com.google.android.apps.plus");
startActivityForResult(shareIntent, 0);
but it works only when official Google+ client is installed on device.
I want to share content whether official Google+ client is installed in device or not.
I found here that it is possible using this library but don't know how to use it ?
Is it possible? Anybody have an idea? If yes, how can it be done?
You cant share to Google+ if the application is not installed in the device. You can use Google App Engine and Google+ APIs to share the content.
https://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
One such example can be found here on Git.
https://github.com/imellon/Google-Plus-Android-Sample
I think you should go for OAuth Authentication of Google Plus. This will provide explicit Authentication then Intent based.
In this mechanism, you are creating one WebView and open link of Google login page. When user is login successful, google return an Token, which you can use in your application to work with its different application like Maps, Location, Google+ etc.
Here is link which have demo application.
You need to register yourself with Google Console and put two important information clientId and clientSecrets.
GOOGLE_PLUS("client id","client secret","https://accounts.google.com/o/oauth2/token","https://accounts.google.com/o/oauth2/auth",BearerToken.authorizationHeaderAccessMethod(),PlusScopes.PLUS_ME,"http://localhost","plus","https://www.googleapis.com/plus/v1/people/me/activities/public")