Error 403: Request had insufficient authentication scopes (reading from Google Sheets in iOS App)












1















I am working on an app to interface and read from a google sheet.
I followed the quick-start guide in this link.



I am making requests to the Google Sheets API using an Oauth 2.0 client ID, but it is giving me an error stating the request had insufficient scopes (Error 403), but I am unsure why since that is the scope that is stated in the Quick-start guide? Not sure if the source of the error is in my setup in the Google Console or in my code below? I set up an Oauth 2.0 Client ID within the Google Console and copied that into my app adding it to one of the URL types in Xcode. I am using the kGTLRAuthScopeSheetsSpreadsheetsReadonly scope. Below is portion of my code performing the request in Swift.



private let service = GTLRSheetsService()
private let scopes = [kGTLRAuthScopeSheetsSpreadsheets, kGTLRAuthScopeSheetsSpreadsheetsReadonly, kGTLRAuthScopeSheetsDrive]

service.authorizer = GIDSignIn.sharedInstance().currentUser!.authentication.fetcherAuthorizer()

let range = "Class!A2:H"

let query = GTLRSheetsQuery_SpreadsheetsValuesGet
.query(withSpreadsheetId: spreadSheetID, range: range)
service.executeQuery(query, delegate: self, didFinish: #selector(ImportStrengthPlansVC.displayResultWithTicket(ticket:finishedWithObject:error:)))









share|improve this question

























  • Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

    – MαπμQμαπkγVπ.0
    Nov 28 '18 at 12:11











  • @MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

    – LGjoraas
    Nov 29 '18 at 3:55











  • I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

    – LGjoraas
    Nov 29 '18 at 4:47
















1















I am working on an app to interface and read from a google sheet.
I followed the quick-start guide in this link.



I am making requests to the Google Sheets API using an Oauth 2.0 client ID, but it is giving me an error stating the request had insufficient scopes (Error 403), but I am unsure why since that is the scope that is stated in the Quick-start guide? Not sure if the source of the error is in my setup in the Google Console or in my code below? I set up an Oauth 2.0 Client ID within the Google Console and copied that into my app adding it to one of the URL types in Xcode. I am using the kGTLRAuthScopeSheetsSpreadsheetsReadonly scope. Below is portion of my code performing the request in Swift.



private let service = GTLRSheetsService()
private let scopes = [kGTLRAuthScopeSheetsSpreadsheets, kGTLRAuthScopeSheetsSpreadsheetsReadonly, kGTLRAuthScopeSheetsDrive]

service.authorizer = GIDSignIn.sharedInstance().currentUser!.authentication.fetcherAuthorizer()

let range = "Class!A2:H"

let query = GTLRSheetsQuery_SpreadsheetsValuesGet
.query(withSpreadsheetId: spreadSheetID, range: range)
service.executeQuery(query, delegate: self, didFinish: #selector(ImportStrengthPlansVC.displayResultWithTicket(ticket:finishedWithObject:error:)))









share|improve this question

























  • Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

    – MαπμQμαπkγVπ.0
    Nov 28 '18 at 12:11











  • @MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

    – LGjoraas
    Nov 29 '18 at 3:55











  • I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

    – LGjoraas
    Nov 29 '18 at 4:47














1












1








1








I am working on an app to interface and read from a google sheet.
I followed the quick-start guide in this link.



I am making requests to the Google Sheets API using an Oauth 2.0 client ID, but it is giving me an error stating the request had insufficient scopes (Error 403), but I am unsure why since that is the scope that is stated in the Quick-start guide? Not sure if the source of the error is in my setup in the Google Console or in my code below? I set up an Oauth 2.0 Client ID within the Google Console and copied that into my app adding it to one of the URL types in Xcode. I am using the kGTLRAuthScopeSheetsSpreadsheetsReadonly scope. Below is portion of my code performing the request in Swift.



private let service = GTLRSheetsService()
private let scopes = [kGTLRAuthScopeSheetsSpreadsheets, kGTLRAuthScopeSheetsSpreadsheetsReadonly, kGTLRAuthScopeSheetsDrive]

service.authorizer = GIDSignIn.sharedInstance().currentUser!.authentication.fetcherAuthorizer()

let range = "Class!A2:H"

let query = GTLRSheetsQuery_SpreadsheetsValuesGet
.query(withSpreadsheetId: spreadSheetID, range: range)
service.executeQuery(query, delegate: self, didFinish: #selector(ImportStrengthPlansVC.displayResultWithTicket(ticket:finishedWithObject:error:)))









share|improve this question
















I am working on an app to interface and read from a google sheet.
I followed the quick-start guide in this link.



I am making requests to the Google Sheets API using an Oauth 2.0 client ID, but it is giving me an error stating the request had insufficient scopes (Error 403), but I am unsure why since that is the scope that is stated in the Quick-start guide? Not sure if the source of the error is in my setup in the Google Console or in my code below? I set up an Oauth 2.0 Client ID within the Google Console and copied that into my app adding it to one of the URL types in Xcode. I am using the kGTLRAuthScopeSheetsSpreadsheetsReadonly scope. Below is portion of my code performing the request in Swift.



private let service = GTLRSheetsService()
private let scopes = [kGTLRAuthScopeSheetsSpreadsheets, kGTLRAuthScopeSheetsSpreadsheetsReadonly, kGTLRAuthScopeSheetsDrive]

service.authorizer = GIDSignIn.sharedInstance().currentUser!.authentication.fetcherAuthorizer()

let range = "Class!A2:H"

let query = GTLRSheetsQuery_SpreadsheetsValuesGet
.query(withSpreadsheetId: spreadSheetID, range: range)
service.executeQuery(query, delegate: self, didFinish: #selector(ImportStrengthPlansVC.displayResultWithTicket(ticket:finishedWithObject:error:)))






swift google-sheets-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 7:26









Triyugi Narayan Mani

1,10941528




1,10941528










asked Nov 28 '18 at 5:02









LGjoraasLGjoraas

61




61













  • Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

    – MαπμQμαπkγVπ.0
    Nov 28 '18 at 12:11











  • @MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

    – LGjoraas
    Nov 29 '18 at 3:55











  • I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

    – LGjoraas
    Nov 29 '18 at 4:47



















  • Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

    – MαπμQμαπkγVπ.0
    Nov 28 '18 at 12:11











  • @MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

    – LGjoraas
    Nov 29 '18 at 3:55











  • I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

    – LGjoraas
    Nov 29 '18 at 4:47

















Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

– MαπμQμαπkγVπ.0
Nov 28 '18 at 12:11





Do you have previously stored credentials? Have you tried clearing it out and execute your code again?

– MαπμQμαπkγVπ.0
Nov 28 '18 at 12:11













@MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

– LGjoraas
Nov 29 '18 at 3:55





@MαπμQμαπkγVπ.0 - what do you mean by clearing it out and executing the code again?

– LGjoraas
Nov 29 '18 at 3:55













I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

– LGjoraas
Nov 29 '18 at 4:47





I am using Firebase authentication as well in this app, so I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Firebase console, and I have an Oauth 2.0 client ID that I got from the GoogleService-info.plist file from the Google console to allow me to read from Google Sheets. Would these client ID's be conflicting with one another?

– LGjoraas
Nov 29 '18 at 4:47












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512451%2ferror-403-request-had-insufficient-authentication-scopes-reading-from-google-s%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512451%2ferror-403-request-had-insufficient-authentication-scopes-reading-from-google-s%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)