Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

mistake in sample code? #26

Open
Maxhodges opened this issue Aug 16, 2018 · 3 comments
Open

mistake in sample code? #26

Maxhodges opened this issue Aug 16, 2018 · 3 comments

Comments

@Maxhodges
Copy link

from the docs

First-time token generation
var provider = new GoogleCloudPrintOAuth2Provider(clientId, clientSecret);

// You should have your redirect uri here if your app is a server application, o.w. leaving blank is ok
var url = provider.BuildAuthorizationUrl(redirectUri);

/* Your method to retrieve authorization code from the above url */
var token = await provider.GenerateRefreshTokenAsync(authorizationCode, redirectUri);

this can't be right can it? the var url is not used in the call which says, "Your method to retrieve authorization code from the above url"

@awerber
Copy link

awerber commented Aug 16, 2018

Yes, it's correct. It took me a long time to figure this out. You can test it out by putting a beak point in the line 'var token ....' as follows:

Enter the value of url into a browser. Sign into the GMail account owning the printers, if you have not done that already in your browser. Accept using the account, and you'll go to a page where the authorization code is in the URL window. Then copy and paste the code and assign it to the variable authorizationCode.

I did this programmatically with a Windows Forms application. I used Process.Start(url) to bring up the browser. I followed that line of code with the display of a form where I pasted in the authorization code.

Currently, I'm trying to do the same thing with a Web application and getting stuck at the point of trying to pop up a new browser instance. If you happen to know how to do that, please let me know.

@Maxhodges
Copy link
Author

Maxhodges commented Aug 17, 2018

@awerber do you do any freelance work by chance? I can't get this working, so hoping to outsource it to someone--ideally someone with relevant experience like yourself!

@awerber
Copy link

awerber commented Aug 17, 2018

I've never freelanced before. I work full time for a company, and I wrote all the GCP code while an employee. I can check with my supervisor about the rules related to this situation.

In the meanwhile, can you describe the nature of your project and the type of business use (or uses) for this functionality?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants