nativescript-oauth
nativescript-oauth copied to clipboard
Unable to use with Google
I have used the plugin to try to get a Google auth token.
`export class GoogleDriveService {
private googleInitOptions: tnsOAuthModule.ITnsOAuthOptionsGoogle = {
clientId: '1234-xxx.apps.googleusercontent.com', //client id for application (GUID)
scope: ['https://www.googleapis.com/auth/drive.metadata.readonly']
};
constructor(
) {
tnsOAuthModule.initGoogle(this.googleInitOptions);
tnsOAuthModule.ensureValidToken()
}
When the app runs it displays the Google Error: disallowed_useragent, as shown below. I have tried with a client ID of type Web application and also Android and both give the same error.
Any suggestions?
David

Hi David, I believe google has discontinued support for in-app authentication, but I'll have to check into it further. If google is the only provider you're using, then I can suggest using a different plugin or manually redirecting the user to a chrome or safari instance and then back to your app.
Alex
On Sep 5, 2017, at 2:54 PM, David Weinberg [email protected] wrote:
I have used the plugin to try to get a Google auth token.
`export class GoogleDriveService {
private googleInitOptions: tnsOAuthModule.ITnsOAuthOptionsGoogle = { clientId: '1234-xxx.apps.googleusercontent.com', //client id for application (GUID) scope: ['https://www.googleapis.com/auth/drive.metadata.readonly'] }; constructor( ) { tnsOAuthModule.initGoogle(this.googleInitOptions); tnsOAuthModule.ensureValidToken() }
When the app runs it displays the Google Error: disallowed_useragent, as shown below. I have tried with a client ID of type Web application and also Android and both give the same error.
Any suggestions?
David
[image: screenshot_2017-09-05_19-47-07] https://user-images.githubusercontent.com/13586902/30077265-2d732f78-9273-11e7-8cc2-f9a5773f0dde.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alexziskind1/nativescript-oauth/issues/53, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkAs4PSep9QXFfxvUNHrd12-A7-Ju6Pks5sfZkBgaJpZM4PNXxx .
Hi Alex,
Thank you for the prompt reply. I am at this point only connecting to Google. Future plans include Dropbox and OneDrive.
Are you able to suggest an alternative {N} plugin or point me in the direction of how to manually redirect to a chrome or safari instance and then back to my app.
TIA,
David
Does nativescript-oauth use an embedded browser for authenticating with the OAuth provider @alexziskind1? Is it related to this change?
I wonder if the discussion here is relevant to finding a solution?
Yes, this plugin uses an embedded browser, so google auth currently doesn’t work. There are plans to convert this plugin to a more standards based approach, but that hasn’t been implemented yet.
On Jan 6, 2018, at 1:14 PM, Jason McNair [email protected] wrote:
Does nativescript-oauth use an embedded browser for authenticating with the OAuth provider? Is it related to this change?
I wonder if the discussion here is relevant to finding a solution?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.